﻿<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	{include file="public/css"}
	<title>成绩表格下载</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i>首页<span class="c-gray en">&gt;</span>
		成绩表格下载
		<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新">
			<i class="Hui-iconfont">
				&#xe68f;
			</i>
		</a>
	</nav>
	<div class="page-container">
		<form>
			<div class="text-c">
				
				{if condition="session('atype') neq 1"}
				<input type="text" name="school" value="{$school}" class="input-text" style="width:100px;margin-right: 20px;" placeholder="机构名称"/>
				{/if}
				<select name="aid" class="input-text" style="width:250px" onchange="window.location=this.value">
					<option value="{:url('score_download')}" data-aid="">机构选择</option>
					{volist name="jigou" id="j"}
					
					<option value="{:url('score_download')}?aid={$j.aid}" {:$key==0?'selected':''} data-aid="{$j.aid}">{$j.name}</option>
					
					{/volist}
				</select>
			<!-- 批次选择： -->
				<select name="sid" class="input-text" style="width:100px;" onchange="window.location=this.value">
					<option value="{:url('score_download')}?aid={$aid}" data-pid="">批次选择</option>
					{volist name="pici" id="j"}
					<option value="{:url('score_download')}?aid={$j.aid}&pid={$j.id}" {:$pid==$j.id?'selected':''} data-pid="{$j.id}">{$j.name}</option>
					{/volist}
				</select>
				<input type="text" name="sname" value="{$sname}" class="input-text" style="width:100px;margin-right: 20px;" placeholder="学员姓名"/>
				<button type="button" class="search btn btn-success"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
				<button type="button" class="getList btn btn-success" style="background-color: #fb0303;border-color: #fb0303;"><i class="Hui-iconfont">&#xe640;</i> 下载列表</button>
			</div>
		</form>
		{if condition="!empty($list)"}
		<div class="cl pd-5 bg-1 bk-gray mt-20">
			<span class="r">
				共有数据：<strong>{$list->total()}</strong>条
			</span>
		</div>
		{/if}
		<div class="mt-20">
			<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
				<thead>
					<tr class="text-c">
						<th width="25"><input type="checkbox" name="" value=""></th>
						<th width="50">ID</th>
						<th>姓名</th>
						<th>考试状态</th>
						<th>成绩</th>
						<!-- <th>认证状态</th> -->
						{if condition="session('atype') neq 1"}
						<th>操作</th>
						{/if}
					</tr>
				</thead>
				<tbody>
					{volist name="list" id="n"}
					<tr class="text-c">
						<td>
							<input type="checkbox" name="ids" value="{$n.id}">
						</td>
						<td>{$n.id}</td>
						<td>{$n.sname}</td>
						<td>{:$n.state==0?'缺考':'正常'}</td>
						<td>{$n.score}</td>
						{if condition="session('atype') neq 1"}
						<td class="f-14 td-manage">
							<a class="ml-5 updata-score" href="javascript:;" title="编辑" data-id="{$n.id}" data-score="{$n.score}">
								<i class="Hui-iconfont">修改成绩</i>
							</a>
						</td>
						{/if}
					</tr>
					{/volist}
				</tbody>
			</table>
			{if condition="!empty($list)"}
			<div class="page">{$list->render()}</div>
			{/if}
		</div>
	</div>
	<!--_footer 作为公共模版分离出去-->
	{include file="public/js"}
	<!--/_footer 作为公共模版分离出去-->
	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
	<script type="text/javascript" src="/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="/admin/lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript">
		$(".updata-score").click(function(){
			var id=$(this).attr("data-id");
				score=$(this).attr("data-score");
			id!=''?title='考级编辑':title='添加考级';
			html="<form><div style='color:#000;position:absolute;top:70%;height:30%;width: 50%;margin: -10% 0 0 25%;'>考试成绩<input type='text' name='score' value='"+score+"'></div></form>";
			var index=layer.open({
					type: 1,
					title: title,
					skin: 'layui-layer-rim', //加上边框
					area: ['420px', '240px'], //宽高
					btn:['确定','取消'],
					content: html,
					yes: function(){
						var score=$("input[name=score]").val();
						if (score=='')  {
							layer.msg('请输入考生成绩',{icon:7,time:1500});
						}else{
							$.post("{:url('update_score')}",{id:id,score:score},function(res){
								layer.close(index);
								if (res.code==200) {
									layer.msg(res.msg,{icon:1,time:1500},function(){
										location.replace(location.href);
									});
								}else{
									layer.msg(res.msg,{icon:2,time:1500});
								}
							})
						}
					}
				});
		})
		$(".getList").click(function(){
			var aid=$("select[name=aid]").find("option:selected").attr("data-aid");
				pid=$("select[name=sid]").find("option:selected").attr("data-pid");//layer.alert(aid+'-'+pid);return false;
			if(aid=='' || aid==undefined){
				layer.alert('请选择机构');return false;
			}else if(pid=='' || pid==undefined){
				layer.alert('请选择下载批次');return false;
			}else{
				location.href="{:url('excel/get_student_card')}"+"?aid="+aid+"&pid="+pid;
			}
		})
		$(".search").click(function(){
			var aid=$("select[name=aid]").find("option:selected").attr("data-aid");
				school=$("input[name=school]").val();
				pid=$("select[name=sid]").find("option:selected").attr("data-pid");//layer.alert(aid+'-'+pid);return false;
			if (school!='') {
				//var url = window.location.href;
				location.href="{:url('score_download')}"+"?school="+school;
			}else{
				if(aid=='' || aid==undefined){
					layer.alert('请选择机构');return false;
				}else if(pid=='' || pid==undefined){
					layer.alert('请选择下载批次');return false;
				}else{
					var sname=$("input[name=sname]").val();
					var url = window.location.href;
					location.href=url+"&sname="+sname;
				}
			}
		})
	</script>
</body>
</html>